package com.example.toutiao.ui.main.presenter

import android.util.Log
import com.example.toutiao.http.HttpUtils
import com.example.toutiao.http.ResponseListener
import com.example.toutiao.http.UserApi
import com.example.toutiao.mvp.model.BaseModel
import com.example.toutiao.mvp.presenter.BasePresenter
import com.example.toutiao.ui.main.model.CommonModel
import com.example.toutiao.ui.main.model.MinVideoModel
import com.example.toutiao.ui.main.view.MinVideoView

class MinVideoPresenter: BasePresenter<MinVideoView>() {
    fun getMinVideoList(){
        HttpUtils.sendHttp(HttpUtils.createApi(UserApi::class.java).getMinVideo(),object :
            ResponseListener<BaseModel<List<MinVideoModel>>> {
            override fun onSuccess(data: BaseModel<List<MinVideoModel>>) {
                if(data!=null&&data.code==200){
                    getBaseView()!!.setData(data.data)
                }
            }
            override fun onFail(err: String) {
                getBaseView()!!.setError(err)
            }

        })
    }
}